#pragma once

#define THREAD_NUM 5

//class MyThreadInfo
//{
//public:
//	MyThreadInfo(void)
//	{
//		m_dwThreadId = 0;	
//		m_hStopEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
//		//m_hStopEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
//
//		if(m_hStopEvent == NULL)
//		{
//			throw ERROR_CREATE_EVENT;
//		}
//	}
//
//	virtual ~MyThreadInfo()
//	{
//		if(m_hStopEvent)
//		{
//			CloseHandle(m_hStopEvent);
//			m_hStopEvent = NULL;
//		}
//	}
//
//private:
//	DWORD m_dwThreadId;
//	HANDLE m_hStopEvent;
//};

typedef struct MyThreadInfo
{
	DWORD dwThreadId;
	HANDLE hStopEvent;
}*pMyThreadInfo;

class MyThread
{
public:
	MyThread(void);
	virtual ~MyThread(void);
	
	BOOL CreateMyThread();
	BOOL StopMyThread(int iThreadIndex);

	static DWORD WINAPI ThreadProc1(LPVOID lParam);
	static DWORD WINAPI ThreadProc2(LPVOID lParam);
	static DWORD WINAPI ThreadProc3(LPVOID lParam);
	static DWORD WINAPI ThreadProc4(LPVOID lParam);
	static DWORD WINAPI ThreadProc5(LPVOID lParam);
private:
	MyThreadInfo m_ThreadInfo[THREAD_NUM];
	static int m_ThreadNum;
};
